package com.iotechn.unimall.data.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.iotechn.unimall.data.domain.DistributionBalanceDetailDO;
import com.iotechn.unimall.data.dto.DistributionOrderDTO;
import com.iotechn.unimall.data.dto.distribution.DistributionDetailExcel;
import com.iotechn.unimall.data.dto.distribution.DistributionStatisicDTO;
import com.iotechn.unimall.data.dto.user.UserAccountDTO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rize
 * Date: 2019/11/28
 * Time: 12:40
 */
public interface DistributionBalanceDetailMapper extends BaseMapper<DistributionBalanceDetailDO> {

    /**
     * 获取分销用户最后一条明细
     * @param distribution
     * @return
     */
    public DistributionBalanceDetailDO getDistributionUserLastForUpdate(Long distribution);

    public List<DistributionOrderDTO> getDistributionOrder(@Param("offset") Integer offset, @Param("limit") Integer limit,@Param("distributionId") Long distributionId);

    public List<DistributionDetailExcel> getDistributionBalanceDetailExcel(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("type") Integer type);

    List<DistributionStatisicDTO> rechAndCons(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("balanceType") Integer balanceType);

    List<DistributionStatisicDTO> allAccount(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<DistributionStatisicDTO> allUserCount(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("balanceType") Integer balanceType);

    /**
     * 所有充值
     * @param gmtStart
     * @param gmtEnd
     * @return
     */
    List<UserAccountDTO> userRecharge(@Param("gmtStart") Date gmtStart,@Param("gmtEnd") Date gmtEnd);

    /**
     * 每个门店的余额消费
     * @param gmtStart
     * @param gmtEnd
     * @return
     */
    List<UserAccountDTO> userConsume(@Param("gmtStart") Date gmtStart,@Param("gmtEnd") Date gmtEnd,@Param("storeId") Long storeId);

    /**
     * 用户期末余额
     * @param gmtStart
     * @return
     */
    List<UserAccountDTO> userEndAccount(@Param("gmtStart") Date gmtStart);

}
